{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
    "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/kaggle/input/ieee-fraud-detection/test_identity.csv\n",
      "/kaggle/input/ieee-fraud-detection/train_transaction.csv\n",
      "/kaggle/input/ieee-fraud-detection/train_identity.csv\n",
      "/kaggle/input/ieee-fraud-detection/sample_submission.csv\n",
      "/kaggle/input/ieee-fraud-detection/test_transaction.csv\n",
      "/kaggle/input/ieee-cis-12nd-solution-part-1/__output__.json\n",
      "/kaggle/input/ieee-cis-12nd-solution-part-1/X_test2.pkl\n",
      "/kaggle/input/ieee-cis-12nd-solution-part-1/X_train2.pkl\n",
      "/kaggle/input/ieee-cis-12nd-solution-part-1/__results__.html\n",
      "/kaggle/input/ieee-cis-12nd-solution-part-1/__notebook__.ipynb\n",
      "/kaggle/input/ieee-cis-12nd-solution-part-1/y_train2.pkl\n",
      "/kaggle/input/ieee-cis-12nd-solution-part-1/custom.css\n"
     ]
    }
   ],
   "source": [
    "# This Python 3 environment comes with many helpful analytics libraries installed\n",
    "# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n",
    "# For example, here's several helpful packages to load in \n",
    "\n",
    "import numpy as np # linear algebra\n",
    "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
    "\n",
    "# Input data files are available in the \"../input/\" directory.\n",
    "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n",
    "\n",
    "import os\n",
    "for dirname, _, filenames in os.walk('/kaggle/input'):\n",
    "    for filename in filenames:\n",
    "        print(os.path.join(dirname, filename))\n",
    "\n",
    "# Any results you write to the current directory are saved as output."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cloning into 'LightGBM'...\r\n",
      "remote: Enumerating objects: 37, done.\u001b[K\r\n",
      "remote: Counting objects: 100% (37/37), done.\u001b[K\r\n",
      "remote: Compressing objects: 100% (35/35), done.\u001b[K\r\n",
      "remote: Total 14696 (delta 11), reused 3 (delta 0), pack-reused 14659\u001b[K\r\n",
      "Receiving objects: 100% (14696/14696), 10.22 MiB | 10.03 MiB/s, done.\r\n",
      "Resolving deltas: 100% (10553/10553), done.\r\n",
      "Submodule 'include/boost/compute' (https://github.com/boostorg/compute) registered for path 'compute'\r\n",
      "Cloning into '/kaggle/working/LightGBM/compute'...\r\n",
      "remote: Enumerating objects: 21728, done.        \r\n",
      "remote: Total 21728 (delta 0), reused 0 (delta 0), pack-reused 21728        \r\n",
      "Receiving objects: 100% (21728/21728), 8.51 MiB | 5.06 MiB/s, done.\r\n",
      "Resolving deltas: 100% (17565/17565), done.\r\n",
      "Submodule path 'compute': checked out '36c89134d4013b2e5e45bc55656a18bd6141995a'\r\n",
      "debconf: delaying package configuration, since apt-utils is not installed\r\n",
      "Selecting previously unselected package autotools-dev.\r\n",
      "(Reading database ... 60469 files and directories currently installed.)\r\n",
      "Preparing to unpack .../000-autotools-dev_20161112.1_all.deb ...\r\n",
      "Unpacking autotools-dev (20161112.1) ...\r\n",
      "Preparing to unpack .../001-libicu57_57.1-6+deb9u3_amd64.deb ...\r\n",
      "Unpacking libicu57:amd64 (57.1-6+deb9u3) over (57.1-6+deb9u2) ...\r\n",
      "Selecting previously unselected package icu-devtools.\r\n",
      "Preparing to unpack .../002-icu-devtools_57.1-6+deb9u3_amd64.deb ...\r\n",
      "Unpacking icu-devtools (57.1-6+deb9u3) ...\r\n",
      "Selecting previously unselected package libboost1.62-dev:amd64.\r\n",
      "Preparing to unpack .../003-libboost1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-dev:amd64.\r\n",
      "Preparing to unpack .../004-libboost-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost1.62-tools-dev.\r\n",
      "Preparing to unpack .../005-libboost1.62-tools-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost1.62-tools-dev (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-tools-dev.\r\n",
      "Preparing to unpack .../006-libboost-tools-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-tools-dev (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-atomic1.62.0:amd64.\r\n",
      "Preparing to unpack .../007-libboost-atomic1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-atomic1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-atomic1.62-dev:amd64.\r\n",
      "Preparing to unpack .../008-libboost-atomic1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-atomic1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-atomic-dev:amd64.\r\n",
      "Preparing to unpack .../009-libboost-atomic-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-atomic-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-system1.62.0:amd64.\r\n",
      "Preparing to unpack .../010-libboost-system1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-system1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-chrono1.62.0:amd64.\r\n",
      "Preparing to unpack .../011-libboost-chrono1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-chrono1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-chrono1.62-dev:amd64.\r\n",
      "Preparing to unpack .../012-libboost-chrono1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-chrono1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-chrono-dev:amd64.\r\n",
      "Preparing to unpack .../013-libboost-chrono-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-chrono-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-context1.62.0:amd64.\r\n",
      "Preparing to unpack .../014-libboost-context1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-context1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-context1.62-dev:amd64.\r\n",
      "Preparing to unpack .../015-libboost-context1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-context1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-context-dev:amd64.\r\n",
      "Preparing to unpack .../016-libboost-context-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-context-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-thread1.62.0:amd64.\r\n",
      "Preparing to unpack .../017-libboost-thread1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-thread1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-coroutine1.62.0:amd64.\r\n",
      "Preparing to unpack .../018-libboost-coroutine1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-coroutine1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-coroutine1.62-dev:amd64.\r\n",
      "Preparing to unpack .../019-libboost-coroutine1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-coroutine1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-coroutine-dev:amd64.\r\n",
      "Preparing to unpack .../020-libboost-coroutine-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-coroutine-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-date-time1.62.0:amd64.\r\n",
      "Preparing to unpack .../021-libboost-date-time1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-date-time1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-serialization1.62.0:amd64.\r\n",
      "Preparing to unpack .../022-libboost-serialization1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-serialization1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-serialization1.62-dev:amd64.\r\n",
      "Preparing to unpack .../023-libboost-serialization1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-serialization1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-date-time1.62-dev:amd64.\r\n",
      "Preparing to unpack .../024-libboost-date-time1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-date-time1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-date-time-dev:amd64.\r\n",
      "Preparing to unpack .../025-libboost-date-time-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-date-time-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-exception1.62-dev:amd64.\r\n",
      "Preparing to unpack .../026-libboost-exception1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-exception1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-exception-dev:amd64.\r\n",
      "Preparing to unpack .../027-libboost-exception-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-exception-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-fiber1.62.0:amd64.\r\n",
      "Preparing to unpack .../028-libboost-fiber1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-fiber1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-fiber1.62-dev:amd64.\r\n",
      "Preparing to unpack .../029-libboost-fiber1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-fiber1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-fiber-dev:amd64.\r\n",
      "Preparing to unpack .../030-libboost-fiber-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-fiber-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-filesystem1.62.0:amd64.\r\n",
      "Preparing to unpack .../031-libboost-filesystem1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-filesystem1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-system1.62-dev:amd64.\r\n",
      "Preparing to unpack .../032-libboost-system1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-system1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-filesystem1.62-dev:amd64.\r\n",
      "Preparing to unpack .../033-libboost-filesystem1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-filesystem1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-filesystem-dev:amd64.\r\n",
      "Preparing to unpack .../034-libboost-filesystem-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-filesystem-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-regex1.62.0:amd64.\r\n",
      "Preparing to unpack .../035-libboost-regex1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-regex1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-graph1.62.0:amd64.\r\n",
      "Preparing to unpack .../036-libboost-graph1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-graph1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-timer1.62.0:amd64.\r\n",
      "Preparing to unpack .../037-libboost-timer1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-timer1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-test1.62.0:amd64.\r\n",
      "Preparing to unpack .../038-libboost-test1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-test1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-test1.62-dev:amd64.\r\n",
      "Preparing to unpack .../039-libboost-test1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-test1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-graph1.62-dev:amd64.\r\n",
      "Preparing to unpack .../040-libboost-graph1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-graph1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-graph-dev:amd64.\r\n",
      "Preparing to unpack .../041-libboost-graph-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-graph-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libnl-3-200:amd64.\r\n",
      "Preparing to unpack .../042-libnl-3-200_3.2.27-2_amd64.deb ...\r\n",
      "Unpacking libnl-3-200:amd64 (3.2.27-2) ...\r\n",
      "Selecting previously unselected package libnl-route-3-200:amd64.\r\n",
      "Preparing to unpack .../043-libnl-route-3-200_3.2.27-2_amd64.deb ...\r\n",
      "Unpacking libnl-route-3-200:amd64 (3.2.27-2) ...\r\n",
      "Selecting previously unselected package libibverbs1.\r\n",
      "Preparing to unpack .../044-libibverbs1_1.2.1-2_amd64.deb ...\r\n",
      "Unpacking libibverbs1 (1.2.1-2) ...\r\n",
      "Selecting previously unselected package libpsm-infinipath1.\r\n",
      "Preparing to unpack .../045-libpsm-infinipath1_3.3+19.g67c0807.open-3_amd64.deb ...\r\n",
      "Unpacking libpsm-infinipath1 (3.3+19.g67c0807.open-3) ...\r\n",
      "Selecting previously unselected package librdmacm1.\r\n",
      "Preparing to unpack .../046-librdmacm1_1.1.0-2_amd64.deb ...\r\n",
      "Unpacking librdmacm1 (1.1.0-2) ...\r\n",
      "Selecting previously unselected package libfabric1.\r\n",
      "Preparing to unpack .../047-libfabric1_1.4.0-1_amd64.deb ...\r\n",
      "Unpacking libfabric1 (1.4.0-1) ...\r\n",
      "Selecting previously unselected package libnuma1:amd64.\r\n",
      "Preparing to unpack .../048-libnuma1_2.0.11-2.1_amd64.deb ...\r\n",
      "Unpacking libnuma1:amd64 (2.0.11-2.1) ...\r\n",
      "Selecting previously unselected package libhwloc5:amd64.\r\n",
      "Preparing to unpack .../049-libhwloc5_1.11.5-1_amd64.deb ...\r\n",
      "Unpacking libhwloc5:amd64 (1.11.5-1) ...\r\n",
      "Selecting previously unselected package ocl-icd-libopencl1:amd64.\r\n",
      "Preparing to unpack .../050-ocl-icd-libopencl1_2.2.11-1_amd64.deb ...\r\n",
      "Unpacking ocl-icd-libopencl1:amd64 (2.2.11-1) ...\r\n",
      "Selecting previously unselected package libhwloc-plugins.\r\n",
      "Preparing to unpack .../051-libhwloc-plugins_1.11.5-1_amd64.deb ...\r\n",
      "Unpacking libhwloc-plugins (1.11.5-1) ...\r\n",
      "Selecting previously unselected package libopenmpi2:amd64.\r\n",
      "Preparing to unpack .../052-libopenmpi2_2.0.2-2_amd64.deb ...\r\n",
      "Unpacking libopenmpi2:amd64 (2.0.2-2) ...\r\n",
      "Selecting previously unselected package libboost-mpi1.62.0.\r\n",
      "Preparing to unpack .../053-libboost-mpi1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-mpi1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-graph-parallel1.62.0.\r\n",
      "Preparing to unpack .../054-libboost-graph-parallel1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-graph-parallel1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-graph-parallel1.62-dev.\r\n",
      "Preparing to unpack .../055-libboost-graph-parallel1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-graph-parallel1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-graph-parallel-dev.\r\n",
      "Preparing to unpack .../056-libboost-graph-parallel-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-graph-parallel-dev (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libicu-dev.\r\n",
      "Preparing to unpack .../057-libicu-dev_57.1-6+deb9u3_amd64.deb ...\r\n",
      "Unpacking libicu-dev (57.1-6+deb9u3) ...\r\n",
      "Selecting previously unselected package libboost-regex1.62-dev:amd64.\r\n",
      "Preparing to unpack .../058-libboost-regex1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-regex1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-iostreams1.62.0:amd64.\r\n",
      "Preparing to unpack .../059-libboost-iostreams1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-iostreams1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-iostreams1.62-dev:amd64.\r\n",
      "Preparing to unpack .../060-libboost-iostreams1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-iostreams1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-iostreams-dev:amd64.\r\n",
      "Preparing to unpack .../061-libboost-iostreams-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-iostreams-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-locale1.62.0:amd64.\r\n",
      "Preparing to unpack .../062-libboost-locale1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-locale1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-locale1.62-dev:amd64.\r\n",
      "Preparing to unpack .../063-libboost-locale1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-locale1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-locale-dev:amd64.\r\n",
      "Preparing to unpack .../064-libboost-locale-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-locale-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-log1.62.0.\r\n",
      "Preparing to unpack .../065-libboost-log1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-log1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-thread1.62-dev:amd64.\r\n",
      "Preparing to unpack .../066-libboost-thread1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-thread1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-log1.62-dev.\r\n",
      "Preparing to unpack .../067-libboost-log1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-log1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-log-dev.\r\n",
      "Preparing to unpack .../068-libboost-log-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-log-dev (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-math1.62.0:amd64.\r\n",
      "Preparing to unpack .../069-libboost-math1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-math1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-math1.62-dev:amd64.\r\n",
      "Preparing to unpack .../070-libboost-math1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-math1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-math-dev:amd64.\r\n",
      "Preparing to unpack .../071-libboost-math-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-math-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package openmpi-common.\r\n",
      "Preparing to unpack .../072-openmpi-common_2.0.2-2_all.deb ...\r\n",
      "Unpacking openmpi-common (2.0.2-2) ...\r\n",
      "Selecting previously unselected package libibverbs-dev.\r\n",
      "Preparing to unpack .../073-libibverbs-dev_1.2.1-2_amd64.deb ...\r\n",
      "Unpacking libibverbs-dev (1.2.1-2) ...\r\n",
      "Selecting previously unselected package libnuma-dev:amd64.\r\n",
      "Preparing to unpack .../074-libnuma-dev_2.0.11-2.1_amd64.deb ...\r\n",
      "Unpacking libnuma-dev:amd64 (2.0.11-2.1) ...\r\n",
      "Selecting previously unselected package libltdl-dev:amd64.\r\n",
      "Preparing to unpack .../075-libltdl-dev_2.4.6-2_amd64.deb ...\r\n",
      "Unpacking libltdl-dev:amd64 (2.4.6-2) ...\r\n",
      "Selecting previously unselected package libhwloc-dev:amd64.\r\n",
      "Preparing to unpack .../076-libhwloc-dev_1.11.5-1_amd64.deb ...\r\n",
      "Unpacking libhwloc-dev:amd64 (1.11.5-1) ...\r\n",
      "Selecting previously unselected package libopenmpi-dev.\r\n",
      "Preparing to unpack .../077-libopenmpi-dev_2.0.2-2_amd64.deb ...\r\n",
      "Unpacking libopenmpi-dev (2.0.2-2) ...\r\n",
      "Selecting previously unselected package mpi-default-dev.\r\n",
      "Preparing to unpack .../078-mpi-default-dev_1.8_amd64.deb ...\r\n",
      "Unpacking mpi-default-dev (1.8) ...\r\n",
      "Selecting previously unselected package libboost-mpi1.62-dev.\r\n",
      "Preparing to unpack .../079-libboost-mpi1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-mpi1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-mpi-dev.\r\n",
      "Preparing to unpack .../080-libboost-mpi-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-mpi-dev (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-python1.62.0.\r\n",
      "Preparing to unpack .../081-libboost-python1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-python1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package openmpi-bin.\r\n",
      "Preparing to unpack .../082-openmpi-bin_2.0.2-2_amd64.deb ...\r\n",
      "Unpacking openmpi-bin (2.0.2-2) ...\r\n",
      "Selecting previously unselected package mpi-default-bin.\r\n",
      "Preparing to unpack .../083-mpi-default-bin_1.8_amd64.deb ...\r\n",
      "Unpacking mpi-default-bin (1.8) ...\r\n",
      "Selecting previously unselected package libboost-mpi-python1.62.0.\r\n",
      "Preparing to unpack .../084-libboost-mpi-python1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-mpi-python1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-mpi-python1.62-dev.\r\n",
      "Preparing to unpack .../085-libboost-mpi-python1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-mpi-python1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-mpi-python-dev.\r\n",
      "Preparing to unpack .../086-libboost-mpi-python-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-mpi-python-dev (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-program-options1.62.0:amd64.\r\n",
      "Preparing to unpack .../087-libboost-program-options1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-program-options1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-program-options1.62-dev:amd64.\r\n",
      "Preparing to unpack .../088-libboost-program-options1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-program-options1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-program-options-dev:amd64.\r\n",
      "Preparing to unpack .../089-libboost-program-options-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-program-options-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libpython2.7:amd64.\r\n",
      "Preparing to unpack .../090-libpython2.7_2.7.13-2+deb9u3_amd64.deb ...\r\n",
      "Unpacking libpython2.7:amd64 (2.7.13-2+deb9u3) ...\r\n",
      "Preparing to unpack .../091-libexpat1_2.2.0-2+deb9u3_amd64.deb ...\r\n",
      "Unpacking libexpat1:amd64 (2.2.0-2+deb9u3) over (2.2.0-2+deb9u1) ...\r\n",
      "Selecting previously unselected package libexpat1-dev:amd64.\r\n",
      "Preparing to unpack .../092-libexpat1-dev_2.2.0-2+deb9u3_amd64.deb ...\r\n",
      "Unpacking libexpat1-dev:amd64 (2.2.0-2+deb9u3) ...\r\n",
      "Selecting previously unselected package libpython2.7-dev:amd64.\r\n",
      "Preparing to unpack .../093-libpython2.7-dev_2.7.13-2+deb9u3_amd64.deb ...\r\n",
      "Unpacking libpython2.7-dev:amd64 (2.7.13-2+deb9u3) ...\r\n",
      "Selecting previously unselected package libpython-dev:amd64.\r\n",
      "Preparing to unpack .../094-libpython-dev_2.7.13-2_amd64.deb ...\r\n",
      "Unpacking libpython-dev:amd64 (2.7.13-2) ...\r\n",
      "Selecting previously unselected package python2.7-dev.\r\n",
      "Preparing to unpack .../095-python2.7-dev_2.7.13-2+deb9u3_amd64.deb ...\r\n",
      "Unpacking python2.7-dev (2.7.13-2+deb9u3) ...\r\n",
      "Selecting previously unselected package python-dev.\r\n",
      "Preparing to unpack .../096-python-dev_2.7.13-2_amd64.deb ...\r\n",
      "Unpacking python-dev (2.7.13-2) ...\r\n",
      "Selecting previously unselected package libpython3.5:amd64.\r\n",
      "Preparing to unpack .../097-libpython3.5_3.5.3-1+deb9u1_amd64.deb ...\r\n",
      "Unpacking libpython3.5:amd64 (3.5.3-1+deb9u1) ...\r\n",
      "Selecting previously unselected package libpython3.5-dev:amd64.\r\n",
      "Preparing to unpack .../098-libpython3.5-dev_3.5.3-1+deb9u1_amd64.deb ...\r\n",
      "Unpacking libpython3.5-dev:amd64 (3.5.3-1+deb9u1) ...\r\n",
      "Selecting previously unselected package libpython3-dev:amd64.\r\n",
      "Preparing to unpack .../099-libpython3-dev_3.5.3-1_amd64.deb ...\r\n",
      "Unpacking libpython3-dev:amd64 (3.5.3-1) ...\r\n",
      "Selecting previously unselected package python3.5-dev.\r\n",
      "Preparing to unpack .../100-python3.5-dev_3.5.3-1+deb9u1_amd64.deb ...\r\n",
      "Unpacking python3.5-dev (3.5.3-1+deb9u1) ...\r\n",
      "Selecting previously unselected package python3-dev.\r\n",
      "Preparing to unpack .../101-python3-dev_3.5.3-1_amd64.deb ...\r\n",
      "Unpacking python3-dev (3.5.3-1) ...\r\n",
      "Selecting previously unselected package libboost-python1.62-dev.\r\n",
      "Preparing to unpack .../102-libboost-python1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-python1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-python-dev.\r\n",
      "Preparing to unpack .../103-libboost-python-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-python-dev (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-random1.62.0:amd64.\r\n",
      "Preparing to unpack .../104-libboost-random1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-random1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-random1.62-dev:amd64.\r\n",
      "Preparing to unpack .../105-libboost-random1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-random1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-random-dev:amd64.\r\n",
      "Preparing to unpack .../106-libboost-random-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-random-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-regex-dev:amd64.\r\n",
      "Preparing to unpack .../107-libboost-regex-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-regex-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-serialization-dev:amd64.\r\n",
      "Preparing to unpack .../108-libboost-serialization-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-serialization-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-signals1.62.0:amd64.\r\n",
      "Preparing to unpack .../109-libboost-signals1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-signals1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-signals1.62-dev:amd64.\r\n",
      "Preparing to unpack .../110-libboost-signals1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-signals1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-signals-dev:amd64.\r\n",
      "Preparing to unpack .../111-libboost-signals-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-signals-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-system-dev:amd64.\r\n",
      "Preparing to unpack .../112-libboost-system-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-system-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-test-dev:amd64.\r\n",
      "Preparing to unpack .../113-libboost-test-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-test-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-thread-dev:amd64.\r\n",
      "Preparing to unpack .../114-libboost-thread-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-thread-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-timer1.62-dev:amd64.\r\n",
      "Preparing to unpack .../115-libboost-timer1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-timer1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-timer-dev:amd64.\r\n",
      "Preparing to unpack .../116-libboost-timer-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-timer-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-type-erasure1.62.0:amd64.\r\n",
      "Preparing to unpack .../117-libboost-type-erasure1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-type-erasure1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-type-erasure1.62-dev:amd64.\r\n",
      "Preparing to unpack .../118-libboost-type-erasure1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-type-erasure1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-type-erasure-dev:amd64.\r\n",
      "Preparing to unpack .../119-libboost-type-erasure-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-type-erasure-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-wave1.62.0:amd64.\r\n",
      "Preparing to unpack .../120-libboost-wave1.62.0_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-wave1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-wave1.62-dev:amd64.\r\n",
      "Preparing to unpack .../121-libboost-wave1.62-dev_1.62.0+dfsg-4_amd64.deb ...\r\n",
      "Unpacking libboost-wave1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Selecting previously unselected package libboost-wave-dev:amd64.\r\n",
      "Preparing to unpack .../122-libboost-wave-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-wave-dev:amd64 (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libboost-all-dev.\r\n",
      "Preparing to unpack .../123-libboost-all-dev_1.62.0.1_amd64.deb ...\r\n",
      "Unpacking libboost-all-dev (1.62.0.1) ...\r\n",
      "Selecting previously unselected package libtool.\r\n",
      "Preparing to unpack .../124-libtool_2.4.6-2_all.deb ...\r\n",
      "Unpacking libtool (2.4.6-2) ...\r\n",
      "Setting up libboost-serialization1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libexpat1:amd64 (2.2.0-2+deb9u3) ...\r\n",
      "Setting up libboost-date-time1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libltdl-dev:amd64 (2.4.6-2) ...\r\n",
      "Setting up libboost1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-program-options1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libpython3.5:amd64 (3.5.3-1+deb9u1) ...\r\n",
      "Setting up libnuma1:amd64 (2.0.11-2.1) ...\r\n",
      "Setting up libboost-program-options1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libicu57:amd64 (57.1-6+deb9u3) ...\r\n",
      "Setting up libhwloc5:amd64 (1.11.5-1) ...\r\n",
      "Setting up libboost-serialization1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-exception1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-iostreams1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libpsm-infinipath1 (3.3+19.g67c0807.open-3) ...\r\n",
      "Setting up libboost-exception-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up openmpi-common (2.0.2-2) ...\r\n",
      "Processing triggers for libc-bin (2.24-11+deb9u4) ...\r\n",
      "Setting up autotools-dev (20161112.1) ...\r\n",
      "Setting up libpython2.7:amd64 (2.7.13-2+deb9u3) ...\r\n",
      "Setting up libboost-atomic1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-math1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libexpat1-dev:amd64 (2.2.0-2+deb9u3) ...\r\n",
      "Setting up libboost-python1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libpython2.7-dev:amd64 (2.7.13-2+deb9u3) ...\r\n",
      "Setting up icu-devtools (57.1-6+deb9u3) ...\r\n",
      "Setting up libboost-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libnuma-dev:amd64 (2.0.11-2.1) ...\r\n",
      "Setting up ocl-icd-libopencl1:amd64 (2.2.11-1) ...\r\n",
      "Setting up libnl-3-200:amd64 (3.2.27-2) ...\r\n",
      "Setting up libboost-signals1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up python2.7-dev (2.7.13-2+deb9u3) ...\r\n",
      "Setting up libboost-context1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-system1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-program-options-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-atomic1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libtool (2.4.6-2) ...\r\n",
      "Setting up libboost-serialization-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libpython-dev:amd64 (2.7.13-2) ...\r\n",
      "Setting up libboost-date-time1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-context1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost1.62-tools-dev (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-atomic-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libhwloc-dev:amd64 (1.11.5-1) ...\r\n",
      "Setting up libboost-thread1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-random1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up python-dev (2.7.13-2) ...\r\n",
      "Setting up libboost-regex1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-fiber1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libnl-route-3-200:amd64 (3.2.27-2) ...\r\n",
      "Setting up libboost-fiber1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-fiber-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libicu-dev (57.1-6+deb9u3) ...\r\n",
      "Setting up libboost-date-time-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libpython3.5-dev:amd64 (3.5.3-1+deb9u1) ...\r\n",
      "Setting up libhwloc-plugins (1.11.5-1) ...\r\n",
      "Setting up libboost-system1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-math1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-filesystem1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-signals1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-context-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up python3.5-dev (3.5.3-1+deb9u1) ...\r\n",
      "Setting up libboost-math-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-chrono1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-random1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-signals-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libpython3-dev:amd64 (3.5.3-1) ...\r\n",
      "Setting up libibverbs1 (1.2.1-2) ...\r\n",
      "Setting up libboost-tools-dev (1.62.0.1) ...\r\n",
      "Setting up libboost-wave1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-filesystem1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-timer1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-coroutine1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-regex1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-graph1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-system-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-log1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-iostreams1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up python3-dev (3.5.3-1) ...\r\n",
      "Setting up librdmacm1 (1.1.0-2) ...\r\n",
      "Setting up libboost-filesystem-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-chrono1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-timer1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-type-erasure1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-locale1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-random-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-iostreams-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-locale1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-test1.62.0:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-thread1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-wave1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-coroutine1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-regex-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-coroutine-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libibverbs-dev (1.2.1-2) ...\r\n",
      "Setting up libboost-log1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-locale-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-thread-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libfabric1 (1.4.0-1) ...\r\n",
      "Setting up libboost-chrono-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-python1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-type-erasure1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-type-erasure-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-timer-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-test1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-log-dev (1.62.0.1) ...\r\n",
      "Setting up libboost-wave-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libopenmpi2:amd64 (2.0.2-2) ...\r\n",
      "Setting up libboost-test-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-python-dev (1.62.0.1) ...\r\n",
      "Setting up libboost-mpi1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libopenmpi-dev (2.0.2-2) ...\r\n",
      "update-alternatives: using /usr/lib/x86_64-linux-gnu/openmpi/include to provide /usr/include/mpi (mpi) in auto mode\r\n",
      "Setting up libboost-graph1.62-dev:amd64 (1.62.0+dfsg-4) ...\r\n",
      "Setting up openmpi-bin (2.0.2-2) ...\r\n",
      "update-alternatives: using /usr/bin/mpirun.openmpi to provide /usr/bin/mpirun (mpirun) in auto mode\r\n",
      "Setting up mpi-default-dev (1.8) ...\r\n",
      "Setting up libboost-graph-parallel1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-graph-parallel1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-mpi1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Setting up mpi-default-bin (1.8) ...\r\n",
      "Setting up libboost-mpi-python1.62.0 (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-graph-dev:amd64 (1.62.0.1) ...\r\n",
      "Setting up libboost-graph-parallel-dev (1.62.0.1) ...\r\n",
      "Setting up libboost-mpi-dev (1.62.0.1) ...\r\n",
      "Setting up libboost-mpi-python1.62-dev (1.62.0+dfsg-4) ...\r\n",
      "Setting up libboost-mpi-python-dev (1.62.0.1) ...\r\n",
      "Setting up libboost-all-dev (1.62.0.1) ...\r\n",
      "Processing triggers for libc-bin (2.24-11+deb9u4) ...\r\n"
     ]
    }
   ],
   "source": [
    "!rm -r /opt/conda/lib/python3.6/site-packages/lightgbm\n",
    "!git clone --recursive https://github.com/Microsoft/LightGBM\n",
    "!apt-get install -y -qq libboost-all-dev"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-- The C compiler identification is GNU 6.3.0\n",
      "-- The CXX compiler identification is GNU 6.3.0\n",
      "-- Check for working C compiler: /usr/bin/cc\n",
      "-- Check for working C compiler: /usr/bin/cc -- works\n",
      "-- Detecting C compiler ABI info\n",
      "-- Detecting C compiler ABI info - done\n",
      "-- Detecting C compile features\n",
      "-- Detecting C compile features - done\n",
      "-- Check for working CXX compiler: /usr/bin/c++\n",
      "-- Check for working CXX compiler: /usr/bin/c++ -- works\n",
      "-- Detecting CXX compiler ABI info\n",
      "-- Detecting CXX compiler ABI info - done\n",
      "-- Detecting CXX compile features\n",
      "-- Detecting CXX compile features - done\n",
      "-- Try OpenMP C flag = [-fopenmp]\n",
      "-- Performing Test OpenMP_FLAG_DETECTED\n",
      "-- Performing Test OpenMP_FLAG_DETECTED - Success\n",
      "-- Try OpenMP CXX flag = [-fopenmp]\n",
      "-- Performing Test OpenMP_FLAG_DETECTED\n",
      "-- Performing Test OpenMP_FLAG_DETECTED - Success\n",
      "-- Found OpenMP: -fopenmp  \n",
      "-- Looking for CL_VERSION_2_0\n",
      "-- Looking for CL_VERSION_2_0 - not found\n",
      "-- Looking for CL_VERSION_1_2\n",
      "-- Looking for CL_VERSION_1_2 - found\n",
      "-- Found OpenCL: /usr/local/cuda/lib64/libOpenCL.so (found version \"1.2\") \n",
      "-- OpenCL include directory: /usr/local/cuda/include\n",
      "-- Boost version: 1.62.0\n",
      "-- Found the following Boost libraries:\n",
      "--   filesystem\n",
      "--   system\n",
      "-- Configuring done\n",
      "-- Generating done\n",
      "-- Build files have been written to: /kaggle/working/LightGBM/build\n",
      "Scanning dependencies of target lightgbm\n",
      "Scanning dependencies of target _lightgbm\n",
      "[  1%] Building CXX object CMakeFiles/_lightgbm.dir/src/c_api.cpp.o\n",
      "[  3%] Building CXX object CMakeFiles/lightgbm.dir/src/main.cpp.o\n",
      "[  4%] Building CXX object CMakeFiles/lightgbm.dir/src/application/application.cpp.o\n",
      "[  6%] Building CXX object CMakeFiles/lightgbm.dir/src/boosting/boosting.cpp.o\n",
      "[  7%] Building CXX object CMakeFiles/_lightgbm.dir/src/lightgbm_R.cpp.o\n",
      "[  9%] Building CXX object CMakeFiles/_lightgbm.dir/src/application/application.cpp.o\n",
      "[ 11%] Building CXX object CMakeFiles/lightgbm.dir/src/boosting/gbdt.cpp.o\n",
      "[ 12%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/boosting.cpp.o\n",
      "[ 14%] Building CXX object CMakeFiles/lightgbm.dir/src/boosting/gbdt_model_text.cpp.o\n",
      "[ 15%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt.cpp.o\n",
      "[ 17%] Building CXX object CMakeFiles/lightgbm.dir/src/boosting/gbdt_prediction.cpp.o\n",
      "[ 19%] Building CXX object CMakeFiles/lightgbm.dir/src/boosting/prediction_early_stop.cpp.o\n",
      "[ 20%] Building CXX object CMakeFiles/lightgbm.dir/src/io/bin.cpp.o\n",
      "[ 22%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt_model_text.cpp.o\n",
      "[ 23%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/gbdt_prediction.cpp.o\n",
      "[ 25%] Building CXX object CMakeFiles/lightgbm.dir/src/io/config.cpp.o\n",
      "[ 26%] Building CXX object CMakeFiles/_lightgbm.dir/src/boosting/prediction_early_stop.cpp.o\n",
      "[ 28%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/bin.cpp.o\n",
      "[ 30%] Building CXX object CMakeFiles/lightgbm.dir/src/io/config_auto.cpp.o\n",
      "[ 31%] Building CXX object CMakeFiles/lightgbm.dir/src/io/dataset.cpp.o\n",
      "[ 33%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/config.cpp.o\n",
      "[ 34%] Building CXX object CMakeFiles/lightgbm.dir/src/io/dataset_loader.cpp.o\n",
      "[ 36%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/config_auto.cpp.o\n",
      "[ 38%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/dataset.cpp.o\n",
      "[ 39%] Building CXX object CMakeFiles/lightgbm.dir/src/io/file_io.cpp.o\n",
      "[ 41%] Building CXX object CMakeFiles/lightgbm.dir/src/io/json11.cpp.o\n",
      "[ 42%] Building CXX object CMakeFiles/lightgbm.dir/src/io/metadata.cpp.o\n",
      "[ 44%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/dataset_loader.cpp.o\n",
      "[ 46%] Building CXX object CMakeFiles/lightgbm.dir/src/io/parser.cpp.o\n",
      "[ 47%] Building CXX object CMakeFiles/lightgbm.dir/src/io/tree.cpp.o\n",
      "[ 49%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/file_io.cpp.o\n",
      "[ 50%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/json11.cpp.o\n",
      "[ 52%] Building CXX object CMakeFiles/lightgbm.dir/src/metric/dcg_calculator.cpp.o\n",
      "[ 53%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/metadata.cpp.o\n",
      "[ 55%] Building CXX object CMakeFiles/lightgbm.dir/src/metric/metric.cpp.o\n",
      "[ 57%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/parser.cpp.o\n",
      "[ 58%] Building CXX object CMakeFiles/_lightgbm.dir/src/io/tree.cpp.o\n",
      "[ 60%] Building CXX object CMakeFiles/lightgbm.dir/src/objective/objective_function.cpp.o\n",
      "[ 61%] Building CXX object CMakeFiles/_lightgbm.dir/src/metric/dcg_calculator.cpp.o\n",
      "[ 63%] Building CXX object CMakeFiles/_lightgbm.dir/src/metric/metric.cpp.o\n",
      "[ 65%] Building CXX object CMakeFiles/lightgbm.dir/src/network/linker_topo.cpp.o\n",
      "[ 66%] Building CXX object CMakeFiles/lightgbm.dir/src/network/linkers_mpi.cpp.o\n",
      "[ 68%] Building CXX object CMakeFiles/lightgbm.dir/src/network/linkers_socket.cpp.o\n",
      "[ 69%] Building CXX object CMakeFiles/_lightgbm.dir/src/objective/objective_function.cpp.o\n",
      "[ 71%] Building CXX object CMakeFiles/lightgbm.dir/src/network/network.cpp.o\n",
      "[ 73%] Building CXX object CMakeFiles/lightgbm.dir/src/treelearner/data_parallel_tree_learner.cpp.o\n",
      "[ 74%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linker_topo.cpp.o\n",
      "[ 76%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linkers_mpi.cpp.o\n",
      "[ 77%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/linkers_socket.cpp.o\n",
      "[ 79%] Building CXX object CMakeFiles/_lightgbm.dir/src/network/network.cpp.o\n",
      "[ 80%] Building CXX object CMakeFiles/lightgbm.dir/src/treelearner/feature_parallel_tree_learner.cpp.o\n",
      "[ 82%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/data_parallel_tree_learner.cpp.o\n",
      "[ 84%] Building CXX object CMakeFiles/lightgbm.dir/src/treelearner/gpu_tree_learner.cpp.o\n",
      "[ 85%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/feature_parallel_tree_learner.cpp.o\n",
      "[ 87%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/gpu_tree_learner.cpp.o\n",
      "[ 88%] Building CXX object CMakeFiles/lightgbm.dir/src/treelearner/serial_tree_learner.cpp.o\n",
      "[ 90%] Building CXX object CMakeFiles/lightgbm.dir/src/treelearner/tree_learner.cpp.o\n",
      "[ 92%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/serial_tree_learner.cpp.o\n",
      "[ 93%] Building CXX object CMakeFiles/lightgbm.dir/src/treelearner/voting_parallel_tree_learner.cpp.o\n",
      "[ 95%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/tree_learner.cpp.o\n",
      "[ 96%] Building CXX object CMakeFiles/_lightgbm.dir/src/treelearner/voting_parallel_tree_learner.cpp.o\n",
      "[ 98%] Linking CXX executable ../lightgbm\n",
      "[ 98%] Built target lightgbm\n",
      "[100%] Linking CXX shared library ../lib_lightgbm.so\n",
      "[100%] Built target _lightgbm\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "rm: cannot remove 'build': No such file or directory\n"
     ]
    }
   ],
   "source": [
    "%%bash\n",
    "cd LightGBM\n",
    "rm -r build\n",
    "mkdir build\n",
    "cd build\n",
    "cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ ..\n",
    "make -j$(nproc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "running install\r\n",
      "running build\r\n",
      "running build_py\r\n",
      "creating build\r\n",
      "creating build/lib\r\n",
      "creating build/lib/lightgbm\r\n",
      "copying lightgbm/sklearn.py -> build/lib/lightgbm\r\n",
      "copying lightgbm/libpath.py -> build/lib/lightgbm\r\n",
      "copying lightgbm/basic.py -> build/lib/lightgbm\r\n",
      "copying lightgbm/compat.py -> build/lib/lightgbm\r\n",
      "copying lightgbm/__init__.py -> build/lib/lightgbm\r\n",
      "copying lightgbm/engine.py -> build/lib/lightgbm\r\n",
      "copying lightgbm/callback.py -> build/lib/lightgbm\r\n",
      "copying lightgbm/plotting.py -> build/lib/lightgbm\r\n",
      "running egg_info\r\n",
      "creating lightgbm.egg-info\r\n",
      "writing lightgbm.egg-info/PKG-INFO\r\n",
      "writing dependency_links to lightgbm.egg-info/dependency_links.txt\r\n",
      "writing requirements to lightgbm.egg-info/requires.txt\r\n",
      "writing top-level names to lightgbm.egg-info/top_level.txt\r\n",
      "writing manifest file 'lightgbm.egg-info/SOURCES.txt'\r\n",
      "reading manifest template 'MANIFEST.in'\r\n",
      "no previously-included directories found matching 'build'\r\n",
      "warning: no files found matching 'LICENSE'\r\n",
      "warning: no files found matching '*.txt'\r\n",
      "warning: no files found matching '*.so' under directory 'lightgbm'\r\n",
      "warning: no files found matching '*.txt' under directory 'compile'\r\n",
      "warning: no files found matching '*.so' under directory 'compile'\r\n",
      "warning: no files found matching '*.dll' under directory 'compile/Release'\r\n",
      "warning: no files found matching '*' under directory 'compile/compute'\r\n",
      "warning: no files found matching '*' under directory 'compile/include'\r\n",
      "warning: no files found matching '*' under directory 'compile/src'\r\n",
      "warning: no files found matching 'LightGBM.sln' under directory 'compile/windows'\r\n",
      "warning: no files found matching 'LightGBM.vcxproj' under directory 'compile/windows'\r\n",
      "warning: no files found matching '*.dll' under directory 'compile/windows/x64/DLL'\r\n",
      "warning: no previously-included files matching '*.py[co]' found anywhere in distribution\r\n",
      "writing manifest file 'lightgbm.egg-info/SOURCES.txt'\r\n",
      "copying lightgbm/VERSION.txt -> build/lib/lightgbm\r\n",
      "running install_lib\r\n",
      "creating /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/sklearn.py -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/VERSION.txt -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/libpath.py -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/basic.py -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/compat.py -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/__init__.py -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/engine.py -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/callback.py -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying build/lib/lightgbm/plotting.py -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "copying ../lib_lightgbm.so -> /opt/conda/lib/python3.6/site-packages/lightgbm\r\n",
      "byte-compiling /opt/conda/lib/python3.6/site-packages/lightgbm/sklearn.py to sklearn.cpython-36.pyc\r\n",
      "byte-compiling /opt/conda/lib/python3.6/site-packages/lightgbm/libpath.py to libpath.cpython-36.pyc\r\n",
      "byte-compiling /opt/conda/lib/python3.6/site-packages/lightgbm/basic.py to basic.cpython-36.pyc\r\n",
      "byte-compiling /opt/conda/lib/python3.6/site-packages/lightgbm/compat.py to compat.cpython-36.pyc\r\n",
      "byte-compiling /opt/conda/lib/python3.6/site-packages/lightgbm/__init__.py to __init__.cpython-36.pyc\r\n",
      "byte-compiling /opt/conda/lib/python3.6/site-packages/lightgbm/engine.py to engine.cpython-36.pyc\r\n",
      "byte-compiling /opt/conda/lib/python3.6/site-packages/lightgbm/callback.py to callback.cpython-36.pyc\r\n",
      "byte-compiling /opt/conda/lib/python3.6/site-packages/lightgbm/plotting.py to plotting.cpython-36.pyc\r\n",
      "running install_egg_info\r\n",
      "Copying lightgbm.egg-info to /opt/conda/lib/python3.6/site-packages/lightgbm-2.3.1-py3.6.egg-info\r\n",
      "running install_scripts\r\n"
     ]
    }
   ],
   "source": [
    "!cd LightGBM/python-package/;python3 setup.py install --precompile"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "!mkdir -p /etc/OpenCL/vendors && echo \"libnvidia-opencl.so.1\" > /etc/OpenCL/vendors/nvidia.icd\n",
    "!rm -r LightGBM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "_cell_guid": "79c7e3d0-c299-4dcb-8224-4455121ee9b0",
    "_uuid": "d629ff2d2480ee46fbb7e2d37f6b5fab8052498a"
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt \n",
    "from sklearn import preprocessing\n",
    "from sklearn.preprocessing import LabelEncoder\n",
    "import catboost as cb\n",
    "import lightgbm as lgb\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.model_selection import GridSearchCV, StratifiedKFold,TimeSeriesSplit,KFold,GroupKFold\n",
    "from sklearn.metrics import roc_auc_score\n",
    "import sqlite3\n",
    "import xgboost as xgb\n",
    "import datetime\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "from scipy.stats import pearsonr\n",
    "import gc\n",
    "from sklearn.model_selection import TimeSeriesSplit\n",
    "import hashlib"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "__print__ = print\n",
    "def print(string):\n",
    "    __print__(string)\n",
    "    os.system(f'echo \\\"{string}\\\"')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train = pd.read_pickle('../input/ieee-cis-12nd-solution-part-1/X_train2.pkl')\n",
    "X_test = pd.read_pickle('../input/ieee-cis-12nd-solution-part-1/X_test2.pkl')\n",
    "y_train = pd.read_pickle('../input/ieee-cis-12nd-solution-part-1/y_train2.pkl')\n",
    "y_train = y_train.isFraud"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "cat = ['uid1','id_12', 'id_13', 'id_14', 'id_15', 'id_16', 'id_17', 'id_18', 'id_19', 'id_20', 'id_21', 'id_22', 'id_23', 'id_24', 'id_25', 'id_26', 'id_27', 'id_28', 'id_29',\n",
    "            'id_30', 'id_31', 'id_32', 'id_33', 'id_34', 'id_35', 'id_36', 'id_37', 'id_38', 'DeviceType', 'ProductCD', 'card4', 'card6', 'M4','P_emaildomain',\n",
    "            'R_emaildomain', 'card1', 'card2', 'card3',  'card5', 'addr1', 'addr2', 'M1', 'M2', 'M3', 'M5', 'M6', 'M7', 'M8', 'M9','hour','dow','device_name', 'OS_id_30',  'browser_id_31','ProductID','DeviceInfo__P_emaildomain', \n",
    "        'card1__card5', \n",
    "        'card2__id_20',\n",
    "        'card5__P_emaildomain', \n",
    "        'addr1__card1',\n",
    "        'addr1__addr2',\n",
    "        'card1__card2',\n",
    "        'card2__addr1',\n",
    "        'card1__P_emaildomain',\n",
    "        'card2__P_emaildomain',\n",
    "        'addr1__P_emaildomain',\n",
    "        'DeviceInfo__id_31',\n",
    "        'DeviceInfo__id_20',\n",
    "        'DeviceType__id_31',\n",
    "        'DeviceType__id_20',\n",
    "        'DeviceType__P_emaildomain',\n",
    "        'card1__M4',\n",
    "        'card2__M4',\n",
    "        'addr1__M4',\n",
    "        'P_emaildomain__M4',\n",
    "       'uid1__ProductID',\n",
    "       'uid1__DeviceInfo']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "cat = set(cat) & set(X_train.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "----------------------------------------\n",
      "card1__card5\n",
      "train:0.6877796901893287\n",
      "test:0.699922931408954\n",
      "----------------------------------------\n",
      "uid1\n",
      "train:0.12073629998472034\n",
      "test:0.13567933094626056\n",
      "----------------------------------------\n",
      "addr1__P_emaildomain\n",
      "train:0.7479224376731302\n",
      "test:0.7792207792207793\n",
      "----------------------------------------\n",
      "R_emaildomain\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "id_31\n",
      "train:0.7175572519083969\n",
      "test:0.6911764705882353\n",
      "----------------------------------------\n",
      "card1__card2\n",
      "train:0.6867254199944919\n",
      "test:0.700765825897562\n",
      "----------------------------------------\n",
      "card1__P_emaildomain\n",
      "train:0.5412019042800303\n",
      "test:0.5949936788874842\n",
      "----------------------------------------\n",
      "addr1__M4\n",
      "train:0.6373983739837399\n",
      "test:0.6962699822380106\n",
      "----------------------------------------\n",
      "uid1__DeviceInfo\n",
      "train:0.1028989375475554\n",
      "test:0.1150085488352212\n",
      "----------------------------------------\n",
      "addr1__addr2\n",
      "train:0.5136986301369864\n",
      "test:0.569620253164557\n",
      "----------------------------------------\n",
      "card2__addr1\n",
      "train:0.7194469805660624\n",
      "test:0.7564454196379594\n",
      "----------------------------------------\n",
      "P_emaildomain__M4\n",
      "train:0.9444444444444444\n",
      "test:0.966824644549763\n",
      "----------------------------------------\n",
      "dow\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "M2\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "addr1\n",
      "train:0.5525525525525525\n",
      "test:0.6279863481228669\n",
      "----------------------------------------\n",
      "id_13\n",
      "train:0.4909090909090909\n",
      "test:0.9642857142857143\n",
      "----------------------------------------\n",
      "M5\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "M4\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "M6\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "card2\n",
      "train:0.9920159680638723\n",
      "test:0.9979919678714859\n",
      "----------------------------------------\n",
      "DeviceType__id_20\n",
      "train:0.7169179229480737\n",
      "test:0.6445783132530121\n",
      "----------------------------------------\n",
      "card5\n",
      "train:0.7\n",
      "test:0.8155339805825242\n",
      "----------------------------------------\n",
      "DeviceType__P_emaildomain\n",
      "train:0.9943502824858758\n",
      "test:0.9887640449438202\n",
      "----------------------------------------\n",
      "M3\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "device_name\n",
      "train:0.8333333333333334\n",
      "test:0.8823529411764706\n",
      "----------------------------------------\n",
      "id_20\n",
      "train:0.7189873417721518\n",
      "test:0.6498855835240275\n",
      "----------------------------------------\n",
      "id_30\n",
      "train:0.9868421052631579\n",
      "test:0.8620689655172413\n",
      "----------------------------------------\n",
      "card2__M4\n",
      "train:0.9207073588134627\n",
      "test:0.9516509433962265\n",
      "----------------------------------------\n",
      "id_19\n",
      "train:0.8738049713193117\n",
      "test:0.9085487077534792\n",
      "----------------------------------------\n",
      "hour\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "id_14\n",
      "train:0.9615384615384616\n",
      "test:0.8928571428571429\n",
      "----------------------------------------\n",
      "P_emaildomain\n",
      "train:1.0\n",
      "test:0.9836065573770492\n",
      "----------------------------------------\n",
      "addr1__card1\n",
      "train:0.5559863911542503\n",
      "test:0.5907604795194173\n",
      "----------------------------------------\n",
      "card6\n",
      "train:0.8\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "M7\n",
      "train:1.0\n",
      "test:1.0\n",
      "----------------------------------------\n",
      "DeviceType__id_31\n",
      "train:0.7254901960784313\n",
      "test:0.6894409937888198\n",
      "----------------------------------------\n",
      "card2__id_20\n",
      "train:0.6699238396321311\n",
      "test:0.6714676652743771\n",
      "----------------------------------------\n",
      "ProductID\n",
      "train:0.2539071666588445\n",
      "test:0.3730777187780153\n",
      "----------------------------------------\n",
      "card1__M4\n",
      "train:0.6411827270793449\n",
      "test:0.6816680989642228\n",
      "----------------------------------------\n",
      "DeviceInfo__id_20\n",
      "train:0.3211884623725873\n",
      "test:0.25567544238239104\n",
      "----------------------------------------\n",
      "id_33\n",
      "train:0.7279693486590039\n",
      "test:0.4859335038363171\n",
      "----------------------------------------\n",
      "card2__P_emaildomain\n",
      "train:0.7593962710861202\n",
      "test:0.8160279853712832\n",
      "----------------------------------------\n",
      "id_18\n",
      "train:0.8947368421052632\n",
      "test:0.9444444444444444\n",
      "----------------------------------------\n",
      "card5__P_emaildomain\n",
      "train:0.7474226804123711\n",
      "test:0.8245329000812348\n",
      "----------------------------------------\n",
      "DeviceInfo__id_31\n",
      "train:0.13367799113737075\n",
      "test:0.1395259202158412\n",
      "----------------------------------------\n",
      "uid1__ProductID\n",
      "train:0.04352361041676135\n",
      "test:0.051496664668066586\n",
      "----------------------------------------\n",
      "card1\n",
      "train:0.7161514055928576\n",
      "test:0.7328601630927213\n",
      "----------------------------------------\n",
      "DeviceInfo__P_emaildomain\n",
      "train:0.40294840294840295\n",
      "test:0.3663859769719883\n"
     ]
    }
   ],
   "source": [
    "\n",
    "for column in cat:\n",
    "    train_set = set(X_train[column])\n",
    "    test_set = set(X_test[column])\n",
    "    tt = train_set.intersection(test_set)\n",
    "    print('----------------------------------------')\n",
    "    print(column)\n",
    "    print(f'train:{len(tt)/len(train_set)}')\n",
    "    print(f'test:{len(tt)/len(test_set)}')\n",
    "    X_train[column] = X_train[column].map(lambda x: -999 if x not in tt else x)\n",
    "    X_test[column] = X_test[column].map(lambda x: -999 if x not in tt else x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# X_train = X_train[:10000]\n",
    "# y_train = y_train[:10000]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Training until validation scores don't improve for 500 rounds\n",
      "[100]\ttraining's auc: 0.94843\tvalid_1's auc: 0.896977\n",
      "[200]\ttraining's auc: 0.965301\tvalid_1's auc: 0.907935\n",
      "[300]\ttraining's auc: 0.975576\tvalid_1's auc: 0.913588\n",
      "[400]\ttraining's auc: 0.982497\tvalid_1's auc: 0.918373\n",
      "[500]\ttraining's auc: 0.987842\tvalid_1's auc: 0.921624\n",
      "[600]\ttraining's auc: 0.991633\tvalid_1's auc: 0.925254\n",
      "[700]\ttraining's auc: 0.994416\tvalid_1's auc: 0.928085\n",
      "[800]\ttraining's auc: 0.996248\tvalid_1's auc: 0.930461\n",
      "[900]\ttraining's auc: 0.997499\tvalid_1's auc: 0.932513\n",
      "[1000]\ttraining's auc: 0.998381\tvalid_1's auc: 0.934241\n",
      "[1100]\ttraining's auc: 0.998931\tvalid_1's auc: 0.935883\n",
      "[1200]\ttraining's auc: 0.9993\tvalid_1's auc: 0.937004\n",
      "[1300]\ttraining's auc: 0.999532\tvalid_1's auc: 0.937976\n",
      "[1400]\ttraining's auc: 0.999683\tvalid_1's auc: 0.938759\n",
      "[1500]\ttraining's auc: 0.999782\tvalid_1's auc: 0.939644\n",
      "[1600]\ttraining's auc: 0.999854\tvalid_1's auc: 0.940289\n",
      "[1700]\ttraining's auc: 0.999902\tvalid_1's auc: 0.940779\n",
      "[1800]\ttraining's auc: 0.999935\tvalid_1's auc: 0.941218\n",
      "[1900]\ttraining's auc: 0.999957\tvalid_1's auc: 0.94153\n",
      "[2000]\ttraining's auc: 0.999972\tvalid_1's auc: 0.941837\n",
      "[2100]\ttraining's auc: 0.999982\tvalid_1's auc: 0.942063\n",
      "[2200]\ttraining's auc: 0.999989\tvalid_1's auc: 0.942387\n",
      "[2300]\ttraining's auc: 0.999993\tvalid_1's auc: 0.942565\n",
      "[2400]\ttraining's auc: 0.999996\tvalid_1's auc: 0.942753\n",
      "[2500]\ttraining's auc: 0.999998\tvalid_1's auc: 0.942908\n",
      "[2600]\ttraining's auc: 0.999999\tvalid_1's auc: 0.943\n",
      "[2700]\ttraining's auc: 0.999999\tvalid_1's auc: 0.943175\n",
      "[2800]\ttraining's auc: 1\tvalid_1's auc: 0.943215\n",
      "[2900]\ttraining's auc: 1\tvalid_1's auc: 0.943256\n",
      "[3000]\ttraining's auc: 1\tvalid_1's auc: 0.943364\n",
      "[3100]\ttraining's auc: 1\tvalid_1's auc: 0.943425\n",
      "[3200]\ttraining's auc: 1\tvalid_1's auc: 0.943485\n",
      "[3300]\ttraining's auc: 1\tvalid_1's auc: 0.943582\n",
      "[3400]\ttraining's auc: 1\tvalid_1's auc: 0.943614\n",
      "[3500]\ttraining's auc: 1\tvalid_1's auc: 0.943734\n",
      "[3600]\ttraining's auc: 1\tvalid_1's auc: 0.943761\n",
      "[3700]\ttraining's auc: 1\tvalid_1's auc: 0.943898\n",
      "[3800]\ttraining's auc: 1\tvalid_1's auc: 0.943931\n",
      "[3900]\ttraining's auc: 1\tvalid_1's auc: 0.943944\n",
      "[4000]\ttraining's auc: 1\tvalid_1's auc: 0.943965\n",
      "[4100]\ttraining's auc: 1\tvalid_1's auc: 0.943987\n",
      "[4200]\ttraining's auc: 1\tvalid_1's auc: 0.943963\n",
      "[4300]\ttraining's auc: 1\tvalid_1's auc: 0.944003\n",
      "[4400]\ttraining's auc: 1\tvalid_1's auc: 0.944096\n",
      "[4500]\ttraining's auc: 1\tvalid_1's auc: 0.944098\n",
      "[4600]\ttraining's auc: 1\tvalid_1's auc: 0.944184\n",
      "[4700]\ttraining's auc: 1\tvalid_1's auc: 0.944151\n",
      "[4800]\ttraining's auc: 1\tvalid_1's auc: 0.94412\n",
      "[4900]\ttraining's auc: 1\tvalid_1's auc: 0.944075\n",
      "[5000]\ttraining's auc: 1\tvalid_1's auc: 0.94406\n",
      "Early stopping, best iteration is:\n",
      "[4595]\ttraining's auc: 1\tvalid_1's auc: 0.944188\n",
      "0.9441880989873468\n",
      "Training until validation scores don't improve for 500 rounds\n",
      "[100]\ttraining's auc: 0.944971\tvalid_1's auc: 0.916829\n",
      "[200]\ttraining's auc: 0.961582\tvalid_1's auc: 0.926952\n",
      "[300]\ttraining's auc: 0.973046\tvalid_1's auc: 0.93458\n",
      "[400]\ttraining's auc: 0.98116\tvalid_1's auc: 0.940773\n",
      "[500]\ttraining's auc: 0.987616\tvalid_1's auc: 0.945589\n",
      "[600]\ttraining's auc: 0.991976\tvalid_1's auc: 0.948849\n",
      "[700]\ttraining's auc: 0.995061\tvalid_1's auc: 0.951127\n",
      "[800]\ttraining's auc: 0.996837\tvalid_1's auc: 0.952648\n",
      "[900]\ttraining's auc: 0.998021\tvalid_1's auc: 0.953934\n",
      "[1000]\ttraining's auc: 0.998759\tvalid_1's auc: 0.954855\n",
      "[1100]\ttraining's auc: 0.999204\tvalid_1's auc: 0.955576\n",
      "[1200]\ttraining's auc: 0.999487\tvalid_1's auc: 0.95618\n",
      "[1300]\ttraining's auc: 0.999662\tvalid_1's auc: 0.956647\n",
      "[1400]\ttraining's auc: 0.999776\tvalid_1's auc: 0.957034\n",
      "[1500]\ttraining's auc: 0.999849\tvalid_1's auc: 0.957444\n",
      "[1600]\ttraining's auc: 0.999901\tvalid_1's auc: 0.957654\n",
      "[1700]\ttraining's auc: 0.999936\tvalid_1's auc: 0.957888\n",
      "[1800]\ttraining's auc: 0.999959\tvalid_1's auc: 0.958009\n",
      "[1900]\ttraining's auc: 0.999974\tvalid_1's auc: 0.95814\n",
      "[2000]\ttraining's auc: 0.999984\tvalid_1's auc: 0.958307\n",
      "[2100]\ttraining's auc: 0.99999\tvalid_1's auc: 0.958514\n",
      "[2200]\ttraining's auc: 0.999994\tvalid_1's auc: 0.958684\n",
      "[2300]\ttraining's auc: 0.999997\tvalid_1's auc: 0.958752\n",
      "[2400]\ttraining's auc: 0.999998\tvalid_1's auc: 0.95887\n",
      "[2500]\ttraining's auc: 0.999999\tvalid_1's auc: 0.959005\n",
      "[2600]\ttraining's auc: 1\tvalid_1's auc: 0.959027\n",
      "[2700]\ttraining's auc: 1\tvalid_1's auc: 0.959128\n",
      "[2800]\ttraining's auc: 1\tvalid_1's auc: 0.959135\n",
      "[2900]\ttraining's auc: 1\tvalid_1's auc: 0.959178\n",
      "[3000]\ttraining's auc: 1\tvalid_1's auc: 0.959276\n",
      "[3100]\ttraining's auc: 1\tvalid_1's auc: 0.959323\n",
      "[3200]\ttraining's auc: 1\tvalid_1's auc: 0.959335\n",
      "[3300]\ttraining's auc: 1\tvalid_1's auc: 0.959301\n",
      "[3400]\ttraining's auc: 1\tvalid_1's auc: 0.959321\n",
      "[3500]\ttraining's auc: 1\tvalid_1's auc: 0.959298\n",
      "[3600]\ttraining's auc: 1\tvalid_1's auc: 0.959262\n",
      "Early stopping, best iteration is:\n",
      "[3178]\ttraining's auc: 1\tvalid_1's auc: 0.959373\n",
      "0.9593728337179331\n",
      "Training until validation scores don't improve for 500 rounds\n",
      "[100]\ttraining's auc: 0.947387\tvalid_1's auc: 0.917023\n",
      "[200]\ttraining's auc: 0.963796\tvalid_1's auc: 0.928431\n",
      "[300]\ttraining's auc: 0.973857\tvalid_1's auc: 0.935102\n",
      "[400]\ttraining's auc: 0.982093\tvalid_1's auc: 0.940945\n",
      "[500]\ttraining's auc: 0.988093\tvalid_1's auc: 0.944394\n",
      "[600]\ttraining's auc: 0.992201\tvalid_1's auc: 0.947081\n",
      "[700]\ttraining's auc: 0.994945\tvalid_1's auc: 0.9489\n",
      "[800]\ttraining's auc: 0.996827\tvalid_1's auc: 0.950047\n",
      "[900]\ttraining's auc: 0.998025\tvalid_1's auc: 0.951328\n",
      "[1000]\ttraining's auc: 0.998758\tvalid_1's auc: 0.952251\n",
      "[1100]\ttraining's auc: 0.999199\tvalid_1's auc: 0.952933\n",
      "[1200]\ttraining's auc: 0.999477\tvalid_1's auc: 0.95337\n",
      "[1300]\ttraining's auc: 0.999649\tvalid_1's auc: 0.953703\n",
      "[1400]\ttraining's auc: 0.999763\tvalid_1's auc: 0.954118\n",
      "[1500]\ttraining's auc: 0.999838\tvalid_1's auc: 0.954437\n",
      "[1600]\ttraining's auc: 0.999893\tvalid_1's auc: 0.954629\n",
      "[1700]\ttraining's auc: 0.99993\tvalid_1's auc: 0.954824\n",
      "[1800]\ttraining's auc: 0.999954\tvalid_1's auc: 0.954881\n",
      "[1900]\ttraining's auc: 0.999971\tvalid_1's auc: 0.954997\n",
      "[2000]\ttraining's auc: 0.999982\tvalid_1's auc: 0.955118\n",
      "[2100]\ttraining's auc: 0.999989\tvalid_1's auc: 0.955157\n",
      "[2200]\ttraining's auc: 0.999994\tvalid_1's auc: 0.955277\n",
      "[2300]\ttraining's auc: 0.999996\tvalid_1's auc: 0.955375\n",
      "[2400]\ttraining's auc: 0.999998\tvalid_1's auc: 0.955337\n",
      "[2500]\ttraining's auc: 0.999999\tvalid_1's auc: 0.955369\n",
      "[2600]\ttraining's auc: 0.999999\tvalid_1's auc: 0.955416\n",
      "[2700]\ttraining's auc: 1\tvalid_1's auc: 0.955398\n",
      "[2800]\ttraining's auc: 1\tvalid_1's auc: 0.955377\n",
      "[2900]\ttraining's auc: 1\tvalid_1's auc: 0.955415\n",
      "[3000]\ttraining's auc: 1\tvalid_1's auc: 0.955452\n",
      "[3100]\ttraining's auc: 1\tvalid_1's auc: 0.955459\n",
      "[3200]\ttraining's auc: 1\tvalid_1's auc: 0.955492\n",
      "[3300]\ttraining's auc: 1\tvalid_1's auc: 0.955482\n",
      "[3400]\ttraining's auc: 1\tvalid_1's auc: 0.955545\n",
      "[3500]\ttraining's auc: 1\tvalid_1's auc: 0.955555\n",
      "[3600]\ttraining's auc: 1\tvalid_1's auc: 0.955524\n",
      "[3700]\ttraining's auc: 1\tvalid_1's auc: 0.955504\n",
      "[3800]\ttraining's auc: 1\tvalid_1's auc: 0.955488\n",
      "[3900]\ttraining's auc: 1\tvalid_1's auc: 0.955445\n",
      "[4000]\ttraining's auc: 1\tvalid_1's auc: 0.955469\n",
      "Early stopping, best iteration is:\n",
      "[3516]\ttraining's auc: 1\tvalid_1's auc: 0.955571\n",
      "0.9555707982274753\n",
      "Training until validation scores don't improve for 500 rounds\n",
      "[100]\ttraining's auc: 0.943648\tvalid_1's auc: 0.929963\n",
      "[200]\ttraining's auc: 0.963102\tvalid_1's auc: 0.942524\n",
      "[300]\ttraining's auc: 0.974235\tvalid_1's auc: 0.949688\n",
      "[400]\ttraining's auc: 0.982007\tvalid_1's auc: 0.953752\n",
      "[500]\ttraining's auc: 0.987891\tvalid_1's auc: 0.957589\n",
      "[600]\ttraining's auc: 0.992065\tvalid_1's auc: 0.959786\n",
      "[700]\ttraining's auc: 0.994825\tvalid_1's auc: 0.961566\n",
      "[800]\ttraining's auc: 0.996689\tvalid_1's auc: 0.963009\n",
      "[900]\ttraining's auc: 0.997947\tvalid_1's auc: 0.964053\n",
      "[1000]\ttraining's auc: 0.998725\tvalid_1's auc: 0.965096\n",
      "[1100]\ttraining's auc: 0.999179\tvalid_1's auc: 0.965863\n",
      "[1200]\ttraining's auc: 0.999473\tvalid_1's auc: 0.966334\n",
      "[1300]\ttraining's auc: 0.999648\tvalid_1's auc: 0.966703\n",
      "[1400]\ttraining's auc: 0.999761\tvalid_1's auc: 0.966983\n",
      "[1500]\ttraining's auc: 0.999836\tvalid_1's auc: 0.967254\n",
      "[1600]\ttraining's auc: 0.999892\tvalid_1's auc: 0.967478\n",
      "[1700]\ttraining's auc: 0.999928\tvalid_1's auc: 0.967636\n",
      "[1800]\ttraining's auc: 0.999952\tvalid_1's auc: 0.967791\n",
      "[1900]\ttraining's auc: 0.999969\tvalid_1's auc: 0.967962\n",
      "[2000]\ttraining's auc: 0.999981\tvalid_1's auc: 0.968079\n",
      "[2100]\ttraining's auc: 0.999988\tvalid_1's auc: 0.968198\n",
      "[2200]\ttraining's auc: 0.999993\tvalid_1's auc: 0.968202\n",
      "[2300]\ttraining's auc: 0.999996\tvalid_1's auc: 0.968237\n",
      "[2400]\ttraining's auc: 0.999998\tvalid_1's auc: 0.968264\n",
      "[2500]\ttraining's auc: 0.999999\tvalid_1's auc: 0.968266\n",
      "[2600]\ttraining's auc: 0.999999\tvalid_1's auc: 0.968301\n",
      "[2700]\ttraining's auc: 1\tvalid_1's auc: 0.968353\n",
      "[2800]\ttraining's auc: 1\tvalid_1's auc: 0.96836\n",
      "[2900]\ttraining's auc: 1\tvalid_1's auc: 0.968371\n",
      "[3000]\ttraining's auc: 1\tvalid_1's auc: 0.968353\n",
      "[3100]\ttraining's auc: 1\tvalid_1's auc: 0.968324\n",
      "[3200]\ttraining's auc: 1\tvalid_1's auc: 0.968272\n",
      "[3300]\ttraining's auc: 1\tvalid_1's auc: 0.968282\n",
      "[3400]\ttraining's auc: 1\tvalid_1's auc: 0.968237\n",
      "Early stopping, best iteration is:\n",
      "[2952]\ttraining's auc: 1\tvalid_1's auc: 0.968383\n",
      "0.968382686943229\n",
      "Training until validation scores don't improve for 500 rounds\n",
      "[100]\ttraining's auc: 0.947826\tvalid_1's auc: 0.905132\n",
      "[200]\ttraining's auc: 0.963979\tvalid_1's auc: 0.915808\n",
      "[300]\ttraining's auc: 0.975167\tvalid_1's auc: 0.923537\n",
      "[400]\ttraining's auc: 0.982504\tvalid_1's auc: 0.92817\n",
      "[500]\ttraining's auc: 0.988248\tvalid_1's auc: 0.931639\n",
      "[600]\ttraining's auc: 0.992092\tvalid_1's auc: 0.934674\n",
      "[700]\ttraining's auc: 0.994875\tvalid_1's auc: 0.937246\n",
      "[800]\ttraining's auc: 0.996758\tvalid_1's auc: 0.938953\n",
      "[900]\ttraining's auc: 0.997987\tvalid_1's auc: 0.940556\n",
      "[1000]\ttraining's auc: 0.998733\tvalid_1's auc: 0.941904\n",
      "[1100]\ttraining's auc: 0.99918\tvalid_1's auc: 0.942663\n",
      "[1200]\ttraining's auc: 0.99946\tvalid_1's auc: 0.943584\n",
      "[1300]\ttraining's auc: 0.999644\tvalid_1's auc: 0.944309\n",
      "[1400]\ttraining's auc: 0.999761\tvalid_1's auc: 0.944741\n",
      "[1500]\ttraining's auc: 0.999836\tvalid_1's auc: 0.945296\n",
      "[1600]\ttraining's auc: 0.999893\tvalid_1's auc: 0.945537\n",
      "[1700]\ttraining's auc: 0.999929\tvalid_1's auc: 0.945755\n",
      "[1800]\ttraining's auc: 0.999953\tvalid_1's auc: 0.945993\n",
      "[1900]\ttraining's auc: 0.999969\tvalid_1's auc: 0.946342\n",
      "[2000]\ttraining's auc: 0.99998\tvalid_1's auc: 0.946525\n",
      "[2100]\ttraining's auc: 0.999988\tvalid_1's auc: 0.946756\n",
      "[2200]\ttraining's auc: 0.999992\tvalid_1's auc: 0.946924\n",
      "[2300]\ttraining's auc: 0.999995\tvalid_1's auc: 0.946985\n",
      "[2400]\ttraining's auc: 0.999997\tvalid_1's auc: 0.947081\n",
      "[2500]\ttraining's auc: 0.999999\tvalid_1's auc: 0.947262\n",
      "[2600]\ttraining's auc: 0.999999\tvalid_1's auc: 0.947337\n",
      "[2700]\ttraining's auc: 1\tvalid_1's auc: 0.94743\n",
      "[2800]\ttraining's auc: 1\tvalid_1's auc: 0.947484\n",
      "[2900]\ttraining's auc: 1\tvalid_1's auc: 0.94755\n",
      "[3000]\ttraining's auc: 1\tvalid_1's auc: 0.947592\n",
      "[3100]\ttraining's auc: 1\tvalid_1's auc: 0.947611\n",
      "[3200]\ttraining's auc: 1\tvalid_1's auc: 0.947656\n",
      "[3300]\ttraining's auc: 1\tvalid_1's auc: 0.94766\n",
      "[3400]\ttraining's auc: 1\tvalid_1's auc: 0.947651\n",
      "[3500]\ttraining's auc: 1\tvalid_1's auc: 0.947661\n",
      "[3600]\ttraining's auc: 1\tvalid_1's auc: 0.947633\n",
      "Early stopping, best iteration is:\n",
      "[3160]\ttraining's auc: 1\tvalid_1's auc: 0.947713\n",
      "0.9477133208463263\n",
      "End:0.9550455477444622\n"
     ]
    }
   ],
   "source": [
    "kf=KFold(n_splits = 5)\n",
    "resu1 = 0\n",
    "impor1 = 0\n",
    "y_pred = 0\n",
    "stack_train = np.zeros([X_train.shape[0],])\n",
    "for train_index, test_index in kf.split(X_train, y_train):\n",
    "    X_train2= X_train.iloc[train_index,:]\n",
    "    y_train2= y_train.iloc[train_index]\n",
    "    X_test2= X_train.iloc[test_index,:]\n",
    "    y_test2= y_train.iloc[test_index]\n",
    "    clf = lgb.LGBMClassifier(n_estimators=100000, random_state=42,subsample=0.7,device=\"gpu\",\n",
    "                             colsample_bytree=0.7,learning_rate=0.005,importance_type = 'gain', #lr记得改\n",
    "                     max_depth = -1, num_leaves = 256,min_child_samples=20,min_split_gain = 0.001,\n",
    "                       bagging_freq=1,reg_alpha = 0,reg_lambda = 0,n_jobs = -1,metric='None')\n",
    "    clf.fit(X_train2,y_train2,eval_set = [(X_train2,y_train2),(X_test2,y_test2)], eval_metric = 'auc',early_stopping_rounds=500,verbose=100) #early_stopping_rounds记得改\n",
    "    temp_predict = clf.predict_proba(X_test2)[:,1]\n",
    "    stack_train[test_index] = temp_predict\n",
    "    y_pred += clf.predict_proba(X_test)[:,1]/5\n",
    "    roc = roc_auc_score(y_test2, temp_predict)\n",
    "    print(roc)\n",
    "    resu1 += roc/5\n",
    "    impor1 += clf.feature_importances_/5\n",
    "    gc.collect()\n",
    "print(f'End:{resu1}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "resu = pd.read_csv('../input/ieee-fraud-detection/sample_submission.csv')\n",
    "resu['isFraud'] = y_pred\n",
    "resu.to_csv('lgb.csv',index=False)\n",
    "a= pd.DataFrame()\n",
    "a['train'] = stack_train\n",
    "a.to_csv('lgb_train.csv',index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
